import DoubleQueue from "./lib/double_queue"

function palindromeChecker(aString: string): boolean {
    if(aString === undefined ||
        aString == null ||
        aString!== null && aString.length == 0
        ) {
            return false
    } 
    // 忽略大小写
    const lowerString: string =
        aString.toLocaleLowerCase().split(' ').join('')

    const queue:DoubleQueue<string> = new DoubleQueue()
    for(let i = 0,len = lowerString.length; i < len; i++) {
        queue.addBack(lowerString.charAt(i))
    }
    while(queue.size() > 1) {
        if(queue.removeFront() !== queue.removeBack()) {
            return false
        }
    }
    return true
}

console.log(palindromeChecker('abba'));
console.log(palindromeChecker('abca'));
